package at.fhj.itm.model;

import javax.microedition.rms.RecordFilter;

public class VocabFilter implements RecordFilter
{
	private String userInput;
	
	public VocabFilter(String userInput)
	{
		setUserInput(userInput);
	}
	
	public VocabFilter(){}	
	

	public boolean matches(byte[] candidate) 
	{
		if (userInput.toLowerCase().startsWith(VocabEntry.getWord(candidate)
				.toLowerCase()))
		{
			return true;
		}
		return false;
	}
	
	public void setUserInput(String userInput )
	{
		if(userInput==null)
		{
			throw new IllegalArgumentException();
		}
		this.userInput=userInput;
	}

}
